cmake_minimum_required (VERSION 3.0)
project (Demo)

aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/foo SOURCE_FOO)
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/foo2 SOURCE_FOO2)

add_executable(Demo5
               ${CMAKE_CURRENT_LIST_DIR}/main.cc
               ${SOURCE_FOO}
               ${SOURCE_FOO2})